<template>
  <h1>我是父组件</h1>
  <hr>
  <div>
    <child :message="parentMessage"></child>
    <child @message-sent="handleMessage"></child>
  </div>
</template>

<script setup>
import child from './child.vue';
function handleMessage(message) {
  alert('接收到了子组件的消息:', message);
}
const parentMessage = '来自父组件的消息';
</script>